<template>
    <div style="width: 100%; height: 100%;">
        <div class="add-board main-container">
            <el-steps
                :active="step"
                finish-status="success"
                simple
                style="margin-bottom: 40px"
            >
                <el-step title="基本信息"></el-step>
                <el-step title="实名资质"></el-step>
            </el-steps>
            <el-form
                v-if="step === 1"
                ref="refForm"
                :rules="rules"
                :model="form"
                label-width="80px"
            >
                <span class="title-medium text-important">基础信息</span>
                <el-row class="row-class">
                    <el-col :span="8">
                        <el-form-item label="用户头像">
                            <el-upload
                                :before-upload="beforeAvatarUpload"
                                :limit="1"
                                accept=".jpg,.png,.bmp"
                                class="avatar-uploader"
                                :action="userAvatorUrl"
                                ref="addItemDataUpload"
                                :on-success="handleAvatarSuccess"
                                :show-file-list="false"
                                :drag="true"
                            >
                                <img
                                    v-if="form.headUrl"
                                    :src="imageServiceURL + form.headUrl"
                                    class="avatar"
                                />
                                <i
                                    v-else
                                    class="el-icon-plus avatar-uploader-icon"
                                ></i>
                                <div
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: -15px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                    <el-col
                        :span="16"
                        class="dimspace"
                    >
                        <el-row class="row-padding-bottom">
                            <el-col :span="12">
                                <el-form-item
                                    label="姓名"
                                    prop="name"
                                >
                                    <el-input
                                        placeholder="姓名"
                                        v-model="form.name"
                                        size="mini"
                                    ></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item
                                    label="手机"
                                    prop="phone"
                                >
                                    <el-input
                                        placeholder="手机号码"
                                        v-model.number="form.phone"
                                        size="mini"
                                    ></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row class="row-padding-bottom">
                            <el-col :span="12">
                                <el-form-item
                                    label="所属机构"
                                    prop="institutionId"
                                >
                                    <el-select
                                        v-model="form.institutionId"
                                        size="mini"
                                        style="width: 100%"
                                        placeholder="请选择"
                                        :disabled="isOrgAdmin"
                                    >
                                        <el-option
                                            v-for="t in institutionsData"
                                            :key="t.value"
                                            :label="t.label"
                                            :value="t.value"
                                        >
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item
                                    label="身份证"
                                    prop="idCard"
                                >
                                    <el-input
                                        placeholder="身份证号"
                                        v-model="form.idCard"
                                        size="mini"
                                    ></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item
                                    label="医生工号"
                                    prop="jobNumber"
                                >
                                    <el-input
                                        placeholder="医生工号"
                                        v-model="form.jobNumber"
                                        size="mini"
                                    ></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="所在地">
                                    <el-cascader
                                        size="mini"
                                        style="width: 100%"
                                        :options="areaOptionsData"
                                        :props="props"
                                        clearable
                                        v-model="area"
                                    >
                                    </el-cascader>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="性别">
                            <el-radio-group v-model="form.gender">
                                <el-radio
                                    v-model="form.gender"
                                    v-for="(ele, index) in sexDate"
                                    :key="index"
                                    :label="ele.dicCode"
                                >{{ ele.dicName }}
                                </el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="学历"
                            prop="education"
                        >
                            <el-input
                                placeholder="学历"
                                v-model="form.education"
                                size="mini"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="专业"
                            prop="major"
                        >
                            <el-input
                                placeholder="专业"
                                v-model="form.major"
                                size="mini"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <span class="title-medium text-important">角色</span>
                <el-row class="row-class row-padding-bottom">
                    <el-col :span="8">
                        <el-form-item
                            label="角色"
                            prop="roles"
                        >
                            <el-select
                                v-model="roles"
                                multiple
                                :disabled="userIfEdit"
                                @change="ifEditPermission"
                                size="mini"
                                style="width: 100%"
                                placeholder="请选择"
                            >
                                <el-option
                                    v-for="item in userGroupsList"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.id"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <div v-if="false">
                    <span class="title-medium text-important">院内诊断权限（诊断组）</span>
                    <el-row class="row-class">
                        <el-col :span="11">
                            <el-form-item label="通用权限">
                                <el-select
                                    size="mini"
                                    clearable
                                    :disabled="isPermissionEdit"
                                    v-model="Permissionvalue"
                                    style="width: 100%"
                                >
                                    <el-option
                                        v-for="s in innerPermission"
                                        :key="s.level"
                                        :label="s.label"
                                        :value="s.level"
                                    >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="row-class">
                        <el-col :span="11">
                            <el-form-item label="初诊">
                                <el-select
                                    v-model="initialDiagnosis"
                                    filterable
                                    :multiple="multiple"
                                    size="mini"
                                    :disabled="isPermissionEdit"
                                    style="width: 100%"
                                    placeholder="初诊"
                                >
                                    <el-option
                                        v-for="s in subGroupsData"
                                        :key="s.id"
                                        :label="s.name"
                                        :value="s.id"
                                    >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col
                            :span="2"
                            :offset="1"
                        >
                            <el-button
                                size="mini"
                                type="primary"
                                @click="initialDiagnosisChooseAll"
                                :disabled="isPermissionEdit"
                                style="margin-top: 5px;"
                            >全选
                            </el-button>
                        </el-col>
                    </el-row>
                    <el-row class="row-class">
                        <el-col :span="11">
                            <el-form-item label="核发">
                                <el-select
                                    v-model="approveIssues"
                                    filterable
                                    :multiple="multiple"
                                    size="mini"
                                    :disabled="isPermissionEdit"
                                    style="width: 100%"
                                    placeholder="核发"
                                >
                                    <el-option
                                        v-for="s in subGroupsData"
                                        :key="s.id"
                                        :label="s.name"
                                        :value="s.id"
                                    >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col
                            :span="2"
                            :offset="1"
                        >
                            <el-button
                                size="mini"
                                type="primary"
                                @click="approveIssuesChooseAll"
                                :disabled="isPermissionEdit"
                                style="margin-top: 5px;"
                            >全选
                            </el-button>
                        </el-col>
                        <el-col :span="4">
                            <el-switch
                                disabled
                                style="margin-top: 10px"
                                v-model="ifReport"
                                active-text="是否能发肿瘤报告"
                            >
                            </el-switch>
                        </el-col>
                        <el-col :span="3">
                            <el-switch
                                disabled
                                style="margin-top: 10px"
                                v-model="ifCytology"
                                active-text="细胞学诊断"
                            >
                            </el-switch>
                        </el-col>
                        <el-col :span="3">
                            <el-switch
                                disabled
                                style="margin-top: 10px"
                                v-model="ifFrozen"
                                active-text="冰冻诊断"
                            >
                            </el-switch>
                        </el-col>
                    </el-row>
                    <el-row class="row-class">
                        <el-col :span="11">
                            <el-form-item label="审核">
                                <el-select
                                    v-model="examine"
                                    filterable
                                    :disabled="isPermissionEdit"
                                    :multiple="multiple"
                                    size="mini"
                                    style="width: 100%"
                                    placeholder="审核"
                                >
                                    <el-option
                                        v-for="s in subGroupsData"
                                        :key="s.id"
                                        :label="s.name"
                                        :value="s.id"
                                    >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col
                            :span="2"
                            :offset="1"
                        >
                            <el-button
                                size="mini"
                                type="primary"
                                @click="examineChooseAll"
                                :disabled="isPermissionEdit"
                                style="margin-top: 5px;"
                            >全选
                            </el-button>
                        </el-col>
                        <el-col :span="4">
                            <el-switch
                                disabled
                                style="margin-top: 10px"
                                v-model="ifReport"
                                active-text="是否能发肿瘤报告"
                            >
                            </el-switch>
                        </el-col>
                        <el-col :span="3">
                            <el-switch
                                disabled
                                style="margin-top: 10px"
                                v-model="ifCytology"
                                active-text="细胞学诊断"
                            >
                            </el-switch>
                        </el-col>
                        <el-col :span="3">
                            <el-switch
                                disabled
                                style="margin-top: 10px"
                                v-model="ifFrozen"
                                active-text="冰冻诊断"
                            >
                            </el-switch>
                        </el-col>
                    </el-row>

                    <el-row class="row-class">
                        <el-col :span="11">
                            <el-form-item label="终审">
                                <el-select
                                    v-model="finallExamine"
                                    filterable
                                    :disabled="isPermissionEdit"
                                    :multiple="multiple"
                                    size="mini"
                                    style="width: 100%"
                                    placeholder="终审"
                                >
                                    <el-option
                                        v-for="s in subGroupsData"
                                        :key="s.id"
                                        :label="s.name"
                                        :value="s.id"
                                    >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col
                            :span="2"
                            :offset="1"
                        >
                            <el-button
                                size="mini"
                                type="primary"
                                @click="finallExamineChooseAll"
                                :disabled="isPermissionEdit"
                                style="margin-top: 5px;"
                            >全选
                            </el-button>
                        </el-col>
                        <el-col :span="4">
                            <el-switch
                                disabled
                                style="margin-top: 10px"
                                v-model="ifReport"
                                active-text="是否能发肿瘤报告"
                            >
                            </el-switch>
                        </el-col>
                        <el-col :span="3">
                            <el-switch
                                disabled
                                style="margin-top: 10px"
                                v-model="ifCytology"
                                active-text="细胞学诊断"
                            >
                            </el-switch>
                        </el-col>
                        <el-col :span="3">
                            <el-switch
                                disabled
                                style="margin-top: 10px"
                                v-model="ifFrozen"
                                active-text="冰冻诊断"
                            >
                            </el-switch>
                        </el-col>
                    </el-row>
                </div>
                <!-- ---------------------------------------------------------- -->
                <span class="title-medium text-important">扩展信息</span>
                <el-row class="row-class">
                    <el-col :span="8">
                        <el-form-item label="签名照片">
                            <el-upload
                                :before-upload="beforeAvatarUpload"
                                :limit="1"
                                accept=".jpg,.png,.bmp"
                                class="avatar-uploader"
                                :action="userAvatorUrl"
                                ref="addItemDataUpload1"
                                :on-success="handleSignAvatarSuccess"
                                :show-file-list="false"
                                :drag="true"
                            >
                                <img
                                    v-if="form.signUrl"
                                    :src="imageServiceURL + form.signUrl"
                                    class="avatar"
                                />
                                <i
                                    v-else
                                    class="el-icon-plus avatar-uploader-icon"
                                ></i>
                                <div
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: -15px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                    <el-col
                        :span="16"
                        class="dimspace"
                    >
                        <el-row class="row-padding-bottom">
                            <el-col :span="12">
                                <el-form-item
                                    label="电子邮箱"
                                    prop="email"
                                >
                                    <el-input
                                        placeholder="电子邮箱"
                                        v-model="form.email"
                                        size="mini"
                                    >
                                    </el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="职级">
                                    <el-select
                                        v-model="form.position"
                                        size="mini"
                                        placeholder="请选择职级"
                                        style="width: 100%"
                                    >
                                        <el-option
                                            v-for="t in postKindData"
                                            :key="t.id"
                                            :label="t.dicName"
                                            :value="t.dicCode"
                                        >
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row class="row-padding-bottom">
                            <el-col :span="12">
                                <el-form-item
                                    label="社会任职"
                                    prop="socialPosition"
                                >
                                    <el-input
                                        placeholder="社会任职"
                                        v-model="form.socialPosition"
                                        size="mini"
                                    >
                                    </el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="职称">
                                    <el-select
                                        v-model="form.medicalTitle"
                                        size="mini"
                                        placeholder="请选择职称"
                                        style="width: 100%"
                                    >
                                        <el-option
                                            v-for="t in titleData"
                                            :key="t.id"
                                            :label="t.dicName"
                                            :value="t.dicCode"
                                        >
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item
                                    label="特长"
                                    prop="speciality"
                                >
                                    <el-input
                                        placeholder="特长"
                                        v-model="form.speciality"
                                        size="mini"
                                    >
                                    </el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item
                                    label="工龄"
                                    prop="workYear"
                                >
                                    <el-input
                                        placeholder="工龄"
                                        v-model="form.workYear"
                                        size="mini"
                                    >
                                    </el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-col>
                </el-row>
                <el-row style="margin-bottom: 10px">
                    <el-col class="dimspace">
                        <el-form-item
                            label="个人简介"
                            prop="introduce"
                        >
                            <el-input
                                type="textarea"
                                :rows="3"
                                style="width: 100%;font-size:12px"
                                placeholder="请输入内容"
                                v-model="form.introduce"
                            >
                            </el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col class="dimspace">
                        <el-form-item
                            label="备注"
                            prop="remark"
                        >
                            <el-input
                                type="textarea"
                                :rows="3"
                                style="width: 100%;font-size:12px"
                                placeholder="请输入内容"
                                v-model="form.remark"
                            >
                            </el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row
                    v-if="step === 1"
                    justify="center"
                    type="flex"
                    style="margin-top: 20px"
                >
                    <el-button
                        type="primary"
                        size="mini"
                        @click="next()"
                    >下一步
                    </el-button>
                </el-row>
            </el-form>
            <el-form
                ref="refFormQualification"
                v-show="step === 2"
                :model="form"
                label-width="160px"
                :rules="rulesQualification"
            >
                <span class="title-medium text-important">实名认证</span>
                <el-row class="row-class">
                    <el-col :span="24">
                        <el-form-item label="手持身份证照片">
                            <el-upload
                                :limit="2"
                                :before-upload="beforeAvatarUpload"
                                accept=".jpg,.png,.bmp"
                                :action="userAvatorUrl"
                                :on-change="changeIDRepos"
                                :file-list="idCardUrltemp"
                                :on-remove="changeIDRepos"
                                list-type="picture-card"
                                :drag="true"
                                :class="{disUploadStyle:noneIdCardImg}"
                            >
                                <el-button
                                    size="mini"
                                    type="primary"
                                    style="margin-top: 57px"
                                >
                                    点击上传
                                </el-button>
                                <div
                                    v-if="form.idCardUrl"
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: -15px"
                                >
                                    只能上传2张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                                <div
                                    v-else
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: 8px"
                                >
                                    只能上传2张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row class="row-class">
                    <el-col :span="24">
                        <el-form-item label="学历证书">
                            <el-upload
                                :before-upload="beforeAvatarUpload"
                                :limit="5"
                                accept=".jpg,.png,.bmp"
                                :action="userAvatorUrl"
                                :on-remove="changeDiplomaRepos"
                                :file-list="diplomaUrltemp"
                                :on-change="changeDiplomaRepos"
                                list-type="picture-card"
                                :drag="true"
                                :class="{disUploadStyle:noneDiplomaReposImg}"
                            >
                                <el-button
                                    size="mini"
                                    type="primary"
                                    style="margin-top: 57px"
                                >
                                    点击上传
                                </el-button>
                                <div
                                    v-if="form.diplomaUrl"
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: -15px"
                                >
                                    只能上5张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                                <div
                                    v-else
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: 8px"
                                >
                                    只能上传5张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
                <span class="title-medium text-important">资质认证</span>
                <el-row class="row-class row-padding-bottom">
                    <el-col :span="12">
                        <el-form-item
                            label="医生执业证书编号"
                            prop="practiceCode"
                        >
                            <el-input
                                placeholder="医生职业证书编号"
                                v-model="form.practiceCode"
                                size="mini"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="医生执业证书编号正面">
                            <el-upload
                                :limit="1"
                                :before-upload="beforeAvatarUpload"
                                accept=".jpg,.png,.bmp"
                                :action="userAvatorUrl"
                                :on-remove="changeCFrontRepos"
                                :on-change="changeCFrontRepos"
                                :file-list="practiceUrlFtemp"
                                list-type="picture-card"
                                :drag="true"
                                :class="{disUploadStyle:noneCFrontReposImg}"
                            >
                                <el-button
                                    size="mini"
                                    type="primary"
                                    style="margin-top: 57px"
                                >点击上传
                                </el-button>
                                <div
                                    v-if="form.practiceUrlF"
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: -15px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                                <div
                                    v-else
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: 8px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="医生执业证书编号反面">
                            <el-upload
                                :limit="1"
                                :before-upload="beforeAvatarUpload"
                                accept=".jpg,.png,.bmp"
                                :action="userAvatorUrl"
                                :on-remove="changeCVersoRepos"
                                :on-change="changeCVersoRepos"
                                :file-list="practiceUrlRtemp"
                                list-type="picture-card"
                                :drag="true"
                                :class="{disUploadStyle:noneCVersoReposImg}"
                            >
                                <el-button
                                    size="mini"
                                    type="primary"
                                    style="margin-top: 57px"
                                >点击上传
                                </el-button>
                                <div
                                    v-if="form.practiceUrlR"
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: -15px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                                <div
                                    v-else
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: 8px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row class="row-padding-bottom">
                    <el-col :span="12">
                        <el-form-item
                            label="医师资格证书编号"
                            prop="qualificationCode"
                        >
                            <el-input
                                placeholder="医师资格证书编号"
                                v-model="form.qualificationCode"
                                size="mini"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="医师资格证书编号正面">
                            <el-upload
                                :limit="1"
                                :before-upload="beforeAvatarUpload"
                                accept=".jpg,.png,.bmp"
                                :action="userAvatorUrl"
                                :on-remove="changeQFrontRepos"
                                :file-list="qualificationUrlFtemp"
                                :on-change="changeQFrontRepos"
                                list-type="picture-card"
                                :drag="true"
                                :class="{disUploadStyle:noneQFrontReposImg}"
                            >
                                <el-button
                                    size="mini"
                                    type="primary"
                                    style="margin-top: 57px"
                                >
                                    点击上传
                                </el-button>
                                <div
                                    v-if="form.qualificationUrlF"
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: -15px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                                <div
                                    v-else
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: 8px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="医师资格证书编号反面">
                            <el-upload
                                :limit="1"
                                :before-upload="beforeAvatarUpload"
                                accept=".jpg,.png,.bmp"
                                :action="userAvatorUrl"
                                :on-remove="changeQVersoRepos"
                                :file-list="qualificationUrlRtemp"
                                :on-change="changeQVersoRepos"
                                list-type="picture-card"
                                :drag="true"
                                :class="{disUploadStyle:noneQVersoReposImg}"
                            >
                                <el-button
                                    size="mini"
                                    type="primary"
                                    style="margin-top: 57px"
                                >
                                    点击上传
                                </el-button>
                                <div
                                    v-if="form.qualificationUrlR"
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: -15px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                                <div
                                    v-else
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: 8px"
                                >
                                    只能上传1张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="医生工牌照片">
                            <el-upload
                                :limit="2"
                                :before-upload="beforeAvatarUpload"
                                accept=".jpg,.png,.bmp"
                                :action="userAvatorUrl"
                                :on-remove="changejobUrl"
                                :file-list="jobUrltemp"
                                :on-change="changejobUrl"
                                list-type="picture-card"
                                :drag="true"
                                :class="{disUploadStyle:nonejobImg}"
                            >
                                <el-button
                                    size="mini"
                                    type="primary"
                                    style="margin-top: 57px"
                                >点击上传
                                </el-button>
                                <div
                                    v-if="form.jobUrl"
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: -15px"
                                >
                                    只能上传2张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                                <div
                                    v-else
                                    slot="tip"
                                    class="el-upload__tip"
                                    style="margin-top: 8px"
                                >
                                    只能上传2张{{ maxUploadFile }}M大小jpg/png/bmp文件
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <el-row
                v-show="step === 2"
                justify="center"
                type="flex"
                style="margin-top: 20px"
            >
                <el-button
                    type="primary"
                    size="mini"
                    @click="back"
                >上一步
                </el-button>
                <el-button
                    type="primary"
                    @click="submitUser"
                    size="mini"
                >提交
                </el-button>
                <el-button
                    size="mini"
                    @click="goBack"
                >返回</el-button>
            </el-row>
        </div>
    </div>
</template>

<script>
import _ from 'lodash';
import { vxRule } from '@/client/libs/validator';

export default {
    name: 'editPersonaluserInfo',
    data() {
        return {
            maxUploadFile: 1, //最大上传大小,单位M
            Permissionvalue: '',
            PermissionvalueID: '',
            innerPermission: [
                {
                    level: 2,
                    label: '初诊',
                    type: '',
                },
                {
                    level: 3,
                    label: '核发',
                    type: '',
                },
                {
                    level: 4,
                    label: '审核',
                    type: '',
                },
                {
                    level: 5,
                    label: '终审',
                    type: '',
                },
            ],
            isAdmin: false, //是否具有管理员权限
            idCardUrltemp: [], // 手持身份证照片URL展示
            idCardUrltempLength: '',
            practiceUrlFtemp: [], // 医师执业正面照url展示
            practiceUrlRtemp: [], // 医师执业反面照url展示
            qualificationUrlRtemp: [], // 医师资格反面照url展示
            qualificationUrlFtemp: [], // 医师资格正面照url展示
            jobUrltemp: [], // 医生工牌照片url
            diplomaUrltemp: [], // 学历证书URL
            // 诊断数据
            subGroupsData: [],
            // 诊断能否编辑
            isPermissionEdit: true,
            // 搜索的地区数据
            areaOptionsData: [],
            props: {
                value: 'id',
                label: 'name',
                children: 'childrenList',
            },
            // 所属机构
            institutionsData: [],
            // 获取用户所有角色
            userGroupsList: [],
            // 性别
            sexDate: [],
            // 上传地址后面写在配置文件里面
            imageServiceURL: '',
            userAvatorUrl: '',
            // 初诊数据
            initialDiagnosis: [],
            // 核发数据
            approveIssues: [],
            // 审核数据
            examine: [],
            // 终审数据:
            finallExamine: [],
            // todo数据
            ifFrozen: false,
            ifCytology: false,
            ifReport: false,
            // 职级
            postKindData: [],
            // 职称
            titleData: [],
            // 区域,上传前还要处理
            area: [],
            // 角色,上传前还要处理
            roles: [],
            step: 1,
            form: {
                headUrl: '', // 用户头像URL
                signUrl: '', // 签名照片
                idCard: '', // 身份证号码
                name: '', // 用户姓名
                phone: '', // 用户电话
                institutionId: null, // 用户机构
                email: '', // 电子邮箱
                gender: null, // 性别ID
                education: '', // 学历
                major: '', // 专业
                jobNumber: '', // 医生工号
                socialPosition: '', // 社会任职
                workYear: '', // 工龄
                position: null, // 职级ID
                speciality: '', // 特长
                medicalTitle: null, // 职称ID
                introduce: '', // 个人简介
                remark: '', // 备注
                cityId: null, // 市区ID
                countyId: null, // 区县ID
                provinceId: null, // 省ID
                practiceCode: '', // 医生职业证书编号
                qualificationCode: '', // 医师资格证书编号
                idCardUrl: '', // 手持身份证照片URL
                practiceUrlF: '', // 医师执业正面照url
                practiceUrlR: '', // 医师执业反面照url
                qualificationUrlR: '', // 医师资格反面照url
                qualificationUrlF: '', // 医师资格正面照url
                jobUrl: '', // 医生工牌照片url
                diplomaUrl: '', // 学历证书URL
                roles: [], // 角色
                diagnosisPermissionVoList: [], // 诊断相关
            },
            rules: {
                name: [
                    vxRule(true, null, 'blur', '请填写姓名'),
                    vxRule(
                        true,
                        'length',
                        'blur',
                        '姓名填写请不要超过20个字符',
                        null,
                        20
                    ),
                ],
                email: [
                    vxRule(false, 'email', 'blur', '请输入正确的电子邮箱'),
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入电子邮箱的长度小于50个字符',
                        null,
                        50
                    ),
                ],
                socialPosition: [
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入社会任职的长度小于50个字符',
                        null,
                        50
                    ),
                ],
                speciality: [
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入特长的长度小于50个字符',
                        null,
                        50
                    ),
                ],
                major: [
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入专业的长度小于50个字符',
                        null,
                        50
                    ),
                ],
                education: [
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入专业的长度小于255个字符',
                        null,
                        255
                    ),
                ],
                introduce: [
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入个人简介的长度小于255个字符',
                        null,
                        255
                    ),
                ],
                remark: [
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入备注的长度小于255个字符',
                        null,
                        255
                    ),
                ],
                workYear: [
                    vxRule(false, 'int', 'blur', '请输入正确的工龄'),
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入工龄的长度小于2位数字',
                        null,
                        2
                    ),
                ],
            },
            rulesQualification: {
                practiceCode: [
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入医生执业证书编号的长度小于50个字符',
                        null,
                        50
                    ),
                ],
                qualificationCode: [
                    vxRule(
                        false,
                        'length',
                        'blur',
                        '请输入医师资格证书编号的长度小于50个字符',
                        null,
                        50
                    ),
                ],
            },
            multiple: true,

            noneIdCardImg: false,
            noneDiplomaReposImg: false,
            noneCFrontReposImg: false,
            noneCVersoReposImg: false,
            nonejobImg: false,
            noneQVersoReposImg: false,
            noneQFrontReposImg: false,
        };
    },
    created() {
        // 获取通用权限ID
        try {
            this.$axios({
                method: 'get',
                url: '/PROXY-Remote/subgroups/special',
            }).then((res2) => {
                if (res2 && res2.data.code === 200 && res2.data.data != null) {
                    const result = res2.data.data;
                    const PermissionvalueID = result.id;
                    this.getTableData(PermissionvalueID);
                } else {
                    this.getTableData();
                }
            });
        } catch (e) {
            console.log('请求失败');
        }
    },
    mounted() {
        // 数据初始化-------------
        // 用户机构
        this.getInstitutionsDate();
        // 行政区域数据初
        this.getareaOptionsData();
        // 获取角色列表
        this.getuserGroupsList();
        // 获取性别
        this.getsexData();
        // 获取诊断数据列表
        this.getsubGroupsDataList();
        // 获取职级
        this.getPostKind();
        // 获取职称
        this.getTitleForClinic();
        // 图片服务器地址
        this.imageServiceURL = process.env.ImageServiceURL;
        // 上传图片链接
        this.userAvatorUrl = `${process.env.ImageServiceURL}/upload`;
        // 获取通用诊断ID
        this.getPermissionvalueID();
    },
    methods: {
        beforeAvatarUpload(file) {
            if (file.size / 1024 / 1024 > this.maxUploadFile) {
                this.$message.warning({
                    message: `图片大于${this.maxUploadFile}M, 请重新选择`,
                });
                return false;
            }
        },
        // 获取表格数据并处理
        getTableData(PermissionvalueID) {
            const id = this.$store.state.userID;
            try {
                this.$axios({
                    method: 'get',
                    url: `/PROXY-Remote/users/${id}`,
                    params: {},
                }).then((res) => {
                    if (res && res.data.code === 200) {
                        // 处理接收的数据
                        this.form = res.data.data.userInfo;
                        // 处理所在地
                        this.area.push(res.data.data.userInfo.provinceId);
                        this.area.push(res.data.data.userInfo.cityId);
                        this.area.push(res.data.data.userInfo.countyId);
                        // 处理角色
                        res.data.data.userInfo.roleVoList.forEach((ele) => {
                            this.roles.push(ele.roleId);
                            if (ele.roleId === 1) {
                                this.isAdmin = true;
                            }
                        });
                        // 处理院内诊断权限（诊断组）
                        if (PermissionvalueID) {
                            res.data.data.userInfo.diagnosisPermissionVoList.forEach(
                                (ele) => {
                                    if (PermissionvalueID === ele.subgroupId) {
                                        this.Permissionvalue =
                                            ele.diagnosisLevelVoList[0].level;
                                    }
                                    ele.diagnosisLevelVoList.forEach((temp) => {
                                        if (
                                            temp.level === 2 &&
                                            PermissionvalueID !== ele.subgroupId
                                        ) {
                                            this.initialDiagnosis.push(
                                                ele.subgroupId
                                            );
                                        }
                                        if (
                                            temp.level === 3 &&
                                            PermissionvalueID !== ele.subgroupId
                                        ) {
                                            this.approveIssues.push(
                                                ele.subgroupId
                                            );
                                        }
                                        if (
                                            temp.level === 4 &&
                                            PermissionvalueID !== ele.subgroupId
                                        ) {
                                            this.examine.push(ele.subgroupId);
                                        }
                                        if (
                                            temp.level === 5 &&
                                            PermissionvalueID !== ele.subgroupId
                                        ) {
                                            this.finallExamine.push(
                                                ele.subgroupId
                                            );
                                        }
                                    });
                                }
                            );
                            this.initialDiagnosis = _.uniq(
                                this.initialDiagnosis
                            );
                            this.approveIssues = _.uniq(this.approveIssues);
                            this.examine = _.uniq(this.examine);
                            this.finallExamine = _.uniq(this.finallExamine);
                        } else {
                            this.$message('院内诊断权限获取失败');
                        }

                        // 处理图片链接
                        if (res.data.data.userInfo.idCardUrl) {
                            res.data.data.userInfo.idCardUrl
                                .split('|')
                                .forEach((tem) => {
                                    if (tem) {
                                        this.idCardUrltemp.push({
                                            name: '',
                                            url: this.imageServiceURL + tem,
                                        });
                                    }
                                });
                        }
                        if (res.data.data.userInfo.practiceUrlF) {
                            res.data.data.userInfo.practiceUrlF
                                .split('|')
                                .forEach((tem) => {
                                    if (tem) {
                                        this.practiceUrlFtemp.push({
                                            name: '',
                                            url: this.imageServiceURL + tem,
                                        });
                                    }
                                });
                        }
                        if (res.data.data.userInfo.practiceUrlR) {
                            res.data.data.userInfo.practiceUrlR
                                .split('|')
                                .forEach((tem) => {
                                    if (tem) {
                                        this.practiceUrlRtemp.push({
                                            name: '',
                                            url: this.imageServiceURL + tem,
                                        });
                                    }
                                });
                        }
                        if (res.data.data.userInfo.qualificationUrlR) {
                            res.data.data.userInfo.qualificationUrlR
                                .split('|')
                                .forEach((tem) => {
                                    if (tem) {
                                        this.qualificationUrlRtemp.push({
                                            name: '',
                                            url: this.imageServiceURL + tem,
                                        });
                                    }
                                });
                        }
                        if (res.data.data.userInfo.qualificationUrlF) {
                            res.data.data.userInfo.qualificationUrlF
                                .split('|')
                                .forEach((tem) => {
                                    if (tem) {
                                        this.qualificationUrlFtemp.push({
                                            name: '',
                                            url: this.imageServiceURL + tem,
                                        });
                                    }
                                });
                        }
                        if (res.data.data.userInfo.jobUrl) {
                            res.data.data.userInfo.jobUrl
                                .split('|')
                                .forEach((tem) => {
                                    if (tem) {
                                        this.jobUrltemp.push({
                                            name: '',
                                            url: this.imageServiceURL + tem,
                                        });
                                    }
                                });
                        }
                        if (res.data.data.userInfo.diplomaUrl) {
                            res.data.data.userInfo.diplomaUrl
                                .split('|')
                                .forEach((tem) => {
                                    if (tem) {
                                        this.diplomaUrltemp.push({
                                            name: '',
                                            url: this.imageServiceURL + tem,
                                        });
                                    }
                                });
                        }
                    }
                });
            } catch (e) {
                console.log(`请求失败  ${e}`);
            }
        },
        initialDiagnosisChooseAll() {
            const alreadyChooseItems = this.initialDiagnosis;
            this.subGroupsData.forEach((item) => {
                if (_.indexOf(alreadyChooseItems, item.name) === -1) {
                    this.initialDiagnosis.push(item.name);
                }
            });
        },
        approveIssuesChooseAll() {
            const alreadyChooseItems = this.approveIssues;
            this.subGroupsData.forEach((item) => {
                if (_.indexOf(alreadyChooseItems, item.name) === -1) {
                    this.approveIssues.push(item.name);
                }
            });
        },
        examineChooseAll() {
            const alreadyChooseItems = this.examine;
            this.subGroupsData.forEach((item) => {
                if (_.indexOf(alreadyChooseItems, item.name) === -1) {
                    this.examine.push(item.name);
                }
            });
        },
        finallExamineChooseAll() {
            const alreadyChooseItems = this.finallExamine;
            this.subGroupsData.forEach((item) => {
                if (_.indexOf(alreadyChooseItems, item.name) === -1) {
                    this.finallExamine.push(item.name);
                }
            });
        },
        // 判断诊断能否编辑
        ifEditPermission(val) {
            this.isPermissionEdit = true;
            for (let i = 0, len = val.length; i < len; i++) {
                for (
                    let j = 0, len2 = this.userGroupsList.length;
                    j < len2;
                    j++
                ) {
                    if (val[i] === this.userGroupsList[j].id) {
                        if (
                            this.userGroupsList[j].data &&
                            this.userGroupsList[j].data.permissions
                        ) {
                            for (
                                let k = 0,
                                    len3 =
                                        this.userGroupsList[j].data.permissions
                                            .length;
                                k < len3;
                                k++
                            ) {
                                if (
                                    this.userGroupsList[j].data.permissions[k]
                                        .code === 'diagnose'
                                ) {
                                    this.isPermissionEdit = false;
                                    return null;
                                }
                            }
                        }
                    }
                }
            }
            // 没有诊断权限数据清空
            if (this.isPermissionEdit) {
                // 初诊数据
                this.initialDiagnosis = [];
                // 核发数据
                this.approveIssues = [];
                // 审核数据
                this.examine = [];
                // 终审数据:
                this.finallExamine = [];
            }
            return null;
        },
        // 获取字典职级数据 职级
        getPostKind() {
            try {
                this.$axios({
                    method: 'get',
                    url: '/PROXY-Remote/dicts/list',
                    params: {
                        code: 'PostKind',
                    },
                }).then((res) => {
                    if (res && res.data.code === 200) {
                        res.data.data.forEach((element) => {
                            this.postKindData.push({
                                dicName: element.name,
                                dicCode: element.id,
                            });
                        });
                    }
                });
            } catch (e) {
                console.logconsole.log(`请求失败  ${e}`);
            }
        },
        // 查找字典职称数据
        getTitleForClinic() {
            try {
                this.$axios({
                    method: 'get',
                    url: '/PROXY-Remote/dicts/list',
                    params: {
                        code: 'TitleForClinic',
                    },
                }).then((res) => {
                    if (res && res.data.code === 200) {
                        res.data.data.forEach((element) => {
                            this.titleData.push({
                                dicName: element.name,
                                dicCode: element.id,
                            });
                        });
                    }
                });
            } catch (e) {
                console.logconsole.log(`请求失败  ${e}`);
            }
        },
        // 获取诊断数据列表
        getsubGroupsDataList() {
            try {
                this.$axios({
                    method: 'get',
                    url: '/PROXY-Remote/subgroups',
                    params: {},
                }).then((res) => {
                    if (res && res.data.code === 200) {
                        res.data.data.forEach((element) => {
                            this.subGroupsData.push({
                                id: element.id,
                                name: element.name,
                            });
                        });
                    }
                });
            } catch (e) {
                console.logconsole.log(`请求失败  ${e}`);
            }
        },
        // 获取性别
        getsexData() {
            try {
                this.$axios({
                    method: 'get',
                    url: '/PROXY-Remote/dicts/list',
                    params: {
                        code: 'SexKind',
                    },
                }).then((res) => {
                    if (res && res.data.code === 200) {
                        res.data.data.forEach((element) => {
                            this.sexDate.push({
                                dicName: element.name,
                                dicCode: element.id,
                            });
                        });
                    }
                });
            } catch (e) {
                console.logconsole.log(`请求失败  ${e}`);
            }
        },
        // 获取角色列表
        getuserGroupsList() {
            try {
                this.$axios({
                    method: 'get',
                    url: '/PROXY-Remote/roles',
                    params: {},
                }).then((res) => {
                    if (res && res.data.code === 200) {
                        res.data.data.forEach((element) => {
                            this.userGroupsList.push({
                                id: element.id,
                                name: element.name,
                                data: element,
                            });
                        });
                    }
                });
            } catch (e) {
                console.logconsole.log(`请求失败  ${e}`);
            }
        },
        // 获取行政区域数据
        getareaOptionsData() {
            try {
                this.$axios({
                    method: 'get',
                    url: '/PROXY-Remote/provinces',
                    params: {},
                }).then((res) => {
                    if (res && res.data.code === 200) {
                        this.areaOptionsData = res.data.data;
                    }
                });
            } catch (e) {
                console.logconsole.log(`请求失败  ${e}`);
            }
        },
        // 获取所需机构I
        getInstitutionsDate() {
            try {
                this.$axios({
                    method: 'get',
                    url: `/PROXY-Remote/institutions/${this.$store.state.institution.id}`,
                    params: {},
                }).then((res) => {
                    if (res && res.data.code === 200) {
                        this.institutionsData.push({
                            value: res.data.data.id,
                            label: res.data.data.name,
                        });
                    }
                });
            } catch (e) {
                console.logconsole.log(`请求失败  ${e}`);
            }
            return '';
        },
        // 回到页面顶部
        goBackTop() {
            document.body.scrollTop = 0;
            document.documentElement.scrollTop = 0;
        },
        // 验证工号唯一
        checkWorkNumberOnly() {
            return false;
        },
        // 检查手机号唯一
        checkPhoneOnly() {
            return false;
        },
        addOrganization() {
            // Meteor.call('organization.add', {});
        },
        submitForm() {
            let decide = false;
            this.$refs.refForm.validate((valid) => {
                if (valid) {
                    decide = true;
                }
            });
            return decide;
        },
        next() {
            if (this.step > 3) {
                return false;
            }
            if (this.submitForm() === true) {
                this.step += 1;
                this.goBackTop();
            }
            return '';
        },
        back() {
            if (this.step < 1) {
                return false;
            }

            this.step -= 1;
            this.goBackTop();
            return null;
        },
        jump2list() {
            this.$router.go(-1);
        },
        // 用户头像图片
        handleAvatarSuccess(res) {
            if (res.status === 'success') {
                this.form.headUrl = res.url.slice(res.url.indexOf('_') - 1);
                this.$refs.addItemDataUpload.clearFiles();
            }
        },
        // 签名照片图片
        handleSignAvatarSuccess(res) {
            if (res.status === 'success') {
                this.form.signUrl = res.url.slice(res.url.indexOf('_') - 1);
                this.$refs.addItemDataUpload1.clearFiles();
            }
        },
        changeIDRepos(file, fileList) {
            this.form.idCardUrl = '';
            if (file.status === 'success') {
                fileList.forEach((ele) => {
                    if (ele.response) {
                        this.form.idCardUrl += `${ele.response.url.slice(
                            ele.response.url.indexOf('_') - 1
                        )}|`;
                    } else {
                        this.form.idCardUrl += `${ele.url.slice(
                            ele.url.indexOf('_') - 1
                        )}|`;
                    }
                });
                this.idCardUrltempLength = fileList.length;
                this.noneIdCardImg = this.idCardUrltempLength >= 2;
            }
        },
        changeDiplomaRepos(file, fileList) {
            this.form.diplomaUrl = '';
            if (file.status === 'success') {
                fileList.forEach((ele) => {
                    if (ele.response) {
                        this.form.diplomaUrl += `${ele.response.url.slice(
                            ele.response.url.indexOf('_') - 1
                        )}|`;
                    } else {
                        this.form.diplomaUrl += `${ele.url.slice(
                            ele.url.indexOf('_') - 1
                        )}|`;
                    }
                });
                this.noneDiplomaReposImg = fileList.length >= 5;
            }
        },
        changeCFrontRepos(file, fileList) {
            this.form.practiceUrlF = '';
            if (file.status === 'success') {
                fileList.forEach((ele) => {
                    if (ele.response) {
                        this.form.practiceUrlF += `${ele.response.url.slice(
                            ele.response.url.indexOf('_') - 1
                        )}|`;
                    } else {
                        this.form.practiceUrlF += `${ele.url.slice(
                            ele.url.indexOf('_') - 1
                        )}|`;
                    }
                });
                this.noneCFrontReposImg = fileList.length >= 1;
            }
        },
        changeCVersoRepos(file, fileList) {
            this.form.practiceUrlR = '';
            if (file.status === 'success') {
                fileList.forEach((ele) => {
                    if (ele.response) {
                        this.form.practiceUrlR += `${ele.response.url.slice(
                            ele.response.url.indexOf('_') - 1
                        )}|`;
                    } else {
                        this.form.practiceUrlR += `${ele.url.slice(
                            ele.url.indexOf('_') - 1
                        )}|`;
                    }
                });
                this.noneCVersoReposImg = fileList.length >= 1;
            }
        },
        changeQFrontRepos(file, fileList) {
            this.form.qualificationUrlF = '';
            if (file.status === 'success') {
                fileList.forEach((ele) => {
                    if (ele.response) {
                        this.form.qualificationUrlF += `${ele.response.url.slice(
                            ele.response.url.indexOf('_') - 1
                        )}|`;
                    } else {
                        this.form.qualificationUrlF += `${ele.url.slice(
                            ele.url.indexOf('_') - 1
                        )}|`;
                    }
                });
                this.noneQFrontReposImg = fileList.length >= 1;
            }
        },
        changeQVersoRepos(file, fileList) {
            this.form.qualificationUrlR = '';
            if (file.status === 'success') {
                fileList.forEach((ele) => {
                    if (ele.response) {
                        this.form.qualificationUrlR += `${ele.response.url.slice(
                            ele.response.url.indexOf('_') - 1
                        )}|`;
                    } else {
                        this.form.qualificationUrlR += `${ele.url.slice(
                            ele.url.indexOf('_') - 1
                        )}|`;
                    }
                });
                this.noneQVersoReposImg = fileList.length >= 1;
            }
        },
        changejobUrl(file, fileList) {
            this.form.jobUrl = '';
            if (file.status === 'success') {
                fileList.forEach((ele) => {
                    if (ele.response) {
                        this.form.jobUrl += `${ele.response.url.slice(
                            ele.response.url.indexOf('_') - 1
                        )}|`;
                    } else {
                        this.form.jobUrl += `${ele.url.slice(
                            ele.url.indexOf('_') - 1
                        )}|`;
                    }
                });
                this.nonejobImg = fileList.length >= 2;
            }
        },
        validateForm() {
            let decide = false;
            this.$refs.refFormQualification.validate((valid) => {
                if (valid) {
                    decide = true;
                }
            });
            return decide;
        },
        submitUser() {
            // 前端数据为null给后端,后端会做处理
            // 处理参数,处理的参数为必填项目
            if (!this.validateForm()) {
                return;
            }
            this.doSubmitPrarm();
            try {
                this.$axios({
                    method: 'put',
                    url: '/PROXY-Remote/users',
                    data: this.form,
                }).then(
                    (res) => {
                        if (res && res.data.code === 200) {
                            const user = {
                                id: res.data.data.id,
                                name: res.data.data.name,
                                headImgUrl: res.data.data.headUrl,
                            };
                            this.$store.commit('setUser', user);
                            this.$message.success(
                                '更新成功,登录时请使用工号或者手机号登录'
                            );
                            this.step = 1;
                        }
                    },
                    (err) => {
                        this.$message.info(
                            `更新失败  ${err.response.data.message}`
                        );
                    }
                );
            } catch (e) {
                this.$message.info(`请求失败  ${e}`);
            }
        },
        // 获取通用权限的ID
        getPermissionvalueID() {
            try {
                this.$axios({
                    method: 'get',
                    url: '/PROXY-Remote/subgroups/special',
                }).then((res) => {
                    if (res && res.data.code === 200) {
                        const result = res.data.data;
                        this.PermissionvalueID = result.id;
                    }
                });
            } catch (e) {
                console.log('请求失败');
            }
        },
        // 处理提交参数
        doSubmitPrarm() {
            // 处理区县数据
            if (this.area.length > 0) {
                [this.form.provinceId, this.form.cityId, this.form.countyId] =
                    this.area;
            }
            // 处理角色权限
            this.form.roles = [];
            if (this.roles.length > 0) {
                this.roles.forEach((ele) => {
                    const role = { id: ele };
                    this.form.roles.push(role);
                });
            }
            // 处理诊断组数据
            this.form.diagnosisPermissionVoList = [];
            // 处理通用权限
            if (this.Permissionvalue !== '' && this.Permissionvalue !== null) {
                this.form.diagnosisPermissionVoList.push({
                    diagnosisLevelVoList: [
                        {
                            level: this.Permissionvalue,
                        },
                    ],
                    subgroupId: this.PermissionvalueID,
                });
            }
            // 初诊
            if (this.initialDiagnosis.length > 0) {
                this.initialDiagnosis.forEach((ele) => {
                    this.form.diagnosisPermissionVoList.push({
                        diagnosisLevelVoList: [
                            {
                                level: 2,
                            },
                        ],
                        subgroupId: ele,
                    });
                });
            }
            // 核发
            if (this.approveIssues.length > 0) {
                this.approveIssues.forEach((ele) => {
                    this.form.diagnosisPermissionVoList.push({
                        diagnosisLevelVoList: [
                            {
                                level: 3,
                            },
                        ],
                        subgroupId: ele,
                    });
                });
            }
            // 审核
            if (this.examine.length > 0) {
                this.examine.forEach((ele) => {
                    this.form.diagnosisPermissionVoList.push({
                        diagnosisLevelVoList: [
                            {
                                level: 4,
                            },
                        ],
                        subgroupId: ele,
                    });
                });
            }
            // 终审
            if (this.finallExamine.length > 0) {
                this.finallExamine.forEach((ele) => {
                    this.form.diagnosisPermissionVoList.push({
                        diagnosisLevelVoList: [
                            {
                                level: 5,
                            },
                        ],
                        subgroupId: ele,
                    });
                });
            }
        },
        goBack() {
            this.$router.go(-1);
        },
    },

    computed: {
        // 院内诊断只有一个机构
        isOrgAdmin() {
            return true;
        },
        // 个人不能编辑一些信息
        userIfEdit() {
            return true;
        },
    },
};
</script>

<style scoped>
.filter-name {
    text-align: left;
    font-size: 16px;
    font-weight: bolder;
    color: #606266;
}

.left-lefta-line {
    float: left;
    font-weight: bold;
    font-family: 黑体;
    font-size: 14px;
    line-height: 30px;
    float: left;
    color: #606266;
}

.success-page div {
    text-align: center;
    margin-top: 60px;
}

.success-page .success-icon {
    font-size: 80px;
    color: #67c23a;
}

.success-page .success-h1 {
    font-size: 40px;
    color: #67c23a;
}

.success-page .success-h2 {
    font-size: 18px;
}

.row-class {
    margin-top: 20px;
}

.row-padding-bottom {
    padding-bottom: 18px;
}

/*.show-none-button:last-child {*/
/*display: none;*/
/*}*/
.table-add-button {
    font-weight: bold;
    color: #409eff;
    margin-left: 10px;
}

.top-line {
    margin-top: 5px;
    margin-bottom: 20px;
    height: 10px;
    border-top: 1px solid #e1e1e1;
}

.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.avatar-uploader .el-upload:hover {
    border-color: #409eff;
}

.avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 146px;
    height: 146px;
    line-height: 146px;
    text-align: center;
}

.avatar {
    width: 146px;
    height: 146px;
    display: block;
}

.add-board.main-container .el-steps.el-steps--simple {
    width: 400px;
    margin: auto;
}

/deep/ .disUploadStyle .el-upload--picture-card {
    display: none;
}
</style>
